<?php
namespace Tlf\Scrawl\Ext\DefaultExt;
/**
* Export code between `// @export_start(key)` and `// @export_end(key)`
*
*/
class ExportStartEnd extends \Tlf\Scrawl\ExtensionType\DefaultExt {
protected $regData = [
'WrappedGenericBlock' =>
//For this regex: $1 is the key, $2 is the code, $3 is the @export_end line
'/\ *(?:\/\/|\#)\ *@export_start\(([^\)]*)\)((?:.|\r|\n)+)\ *(?:\/\/|\#)\ *(@export_end\(\1\))/',
];
public function matchWrappedGenericBlock($info, $key, $code, $exportLine){
$code = \Tlf\Scrawl\Utility::trimTextBlock($code);
$this->scrawl->addOutput('key', $key, $code);
}
//@export_start(Regex.invoke)
public function onSourceFileFound($file){
$this->match('WrappedGenericBlock',$file->content());
}
//@export_end(Regex.invoke)
}